{js:artTemplate}
<script type='text/javascript' src='{theme:javascript/artTemplate/area_select.js}'></script>





<div class="pending-detial">
<div class="panel panel-default">
	<div class="panel-heading">
	<h3 class="panel-title">个人资料</h3>
	</div>
<div class="panel-body">		  
<form action='{url:/ucenter/info_edit_act}' name='user_info' method="POST" class="form-horizontal" role="form">	

		<div class="form-group">
			<label for="input" class="col-sm-2 control-label">姓名:</label>
			<div class="col-sm-10">
				<input type="text" name="true_name"  class="form-control"  pattern="required" initmsg=''>
			</div>


		</div>

		<div class="form-group">
		<div class="radio">
			<div class="radio">
			<label for="input" class="col-sm-2 control-label">性别:</label>
		
			<label>
				<input type="radio" name="sex"  value="1" >
				男
			</label>

			<label>
				<input type="radio" name="sex"  value="2" checked="checked">
				女
			</label>
		</div>
	</div>

		</div>


		<div class="form-group">
			<label for="input" class="col-sm-2 control-label">出生日期:</label>
			<div class="col-sm-2">
				<select name="year"  class="form-control" >
					<option value=""></option>
				</select>
			</div>
			<div class="col-sm-2">
				<select name="month"  class="form-control" >
					<option value=""></option>
				</select>
			</div>
			<div class="col-sm-2">
				<select name="day"  class="form-control" >
					<option value=""></option>
				</select>
			</div>
		</div>



		<div class="form-group">
			<label for="input" class="col-sm-2 control-label">所在地区:</label>
			<div class="col-sm-2">
				<select name="province" child="city,area" onchange="areaChangeCallback(this);"  class="form-control" >
					
				</select>
			</div>
			<div class="col-sm-2">
				<select name="city" child="area" parent="province" onchange="areaChangeCallback(this);"  class="form-control" >
					
				</select>
			</div>
			<div class="col-sm-2">
				<select name="area" parent="city"  class="form-control" >
					
				</select>
			</div>
		</div>


		<div class="form-group">
			<label for="input" class="col-sm-2 control-label">联系地址:</label>
			<div class="col-sm-10">
				<input type="text" name='contact_addr'  class="form-control" value=""  pattern="" title="">
			</div>

		</div>


		<div class="form-group">


	
			<label for="input" class="col-sm-2 control-label">手机号码:</label>
			<div class="col-sm-10">
				<input type="text" name='mobile'  class="form-control" value=""  pattern="" title="">
			</div>

		</div>


		<div class="form-group">


	
			<label for="input" class="col-sm-2 control-label">邮编:</label>
			<div class="col-sm-10">
				<input type="text" name='zip'   class="form-control" value=""  pattern="" title="">
			</div>

		</div>


		<div class="form-group">


	
			<label for="input" class="col-sm-2 control-label">固定电话:</label>
			<div class="col-sm-10">
				<input type="text" name='telephone'  class="form-control" value=""  pattern="" title="">
			</div>

		</div>


		<div class="form-group">


		
			<label for="input" class="col-sm-2 control-label">QQ:</label>
			<div class="col-sm-10">
				<input type="text" name='qq'  class="form-control" value=""  pattern="" title="">
			</div>

		</div>


		<div class="form-group">
	
			<label for="input" class="col-sm-2 control-label">MSN:</label>
			<div class="col-sm-10">
				<input type="text" name='msn'  class="form-control" value=""  pattern="" title="">
			</div>


		</div>


		<div class="form-group">

			<div class="col-sm-10 col-sm-offset-2">
				<button type="submit" class="btn  btn-block" style="width:95%">保存基本信息</button>
			</div>
		</div>
</form>


</div>
</div>
</div>






<script type='text/javascript'>
//DOM加载完毕
$(function(){
	//初始化地域联动
	template.compile("areaTemplate",areaTemplate);

	{if:isset($this->memberRow['area']) && $this->memberRow['area']}
	{set:$area = explode(',',trim($this->memberRow['area'],','))}
	createAreaSelect('province',0,{$area[0]});
	createAreaSelect('city',{$area[0]},{$area[1]});
	createAreaSelect('area',{$area[1]},{$area[2]});
	{else:}
	createAreaSelect('province',0,"");
	{/if}
});

/**
 * 生成地域js联动下拉框
 * @param name
 * @param parent_id
 * @param select_id
 */
function createAreaSelect(name,parent_id,select_id)
{
	//生成地区
	$.getJSON("{url:/block/area_child}",{"aid":parent_id,"random":Math.random()},function(json)
	{
		$('[name="'+name+'"]').html(template.render('areaTemplate',{"select_id":select_id,"data":json}));
	});
}

//出生日期
function dateSelectInit()
{
	var yearHtml = '<option value="">请选择</option>';
	for(var year=2010;year>=1940;year--)
	{
		yearHtml+= '<option value="'+year+'">'+year+'</option>';
	}

	var monthHtml = '<option value="">--</option>';
	for(var month=12;month>=1;month--)
	{
		if(month < 10) month = '0' + month;
		monthHtml+= '<option value="'+month+'">'+month+'</option>';
	}

	var dayHtml = '<option value="">--</option>';
	for(var day=31;day>=1;day--)
	{
		if(day < 10) day = '0' + day;
		dayHtml+= '<option value="'+day+'">'+day+'</option>';
	}

	$('[name="year"]').html(yearHtml);
	$('[name="month"]').html(monthHtml);
	$('[name="day"]').html(dayHtml);
}

//初始化日期
dateSelectInit();

//表单回填
{set:$birthday = explode('-',$this->memberRow['birthday'])}
var formObj = new Form('user_info');
formObj.init({
	'id':'{$this->memberRow['id']}',
	'true_name':'{$this->memberRow['true_name']}',
	'telephone':'{$this->memberRow['telephone']}',
	'mobile':'{$this->memberRow['mobile']}',
	'contact_addr':'{$this->memberRow['contact_addr']}',
	'qq':'{$this->memberRow['qq']}',
	'msn':'{$this->memberRow['msn']}',
	'sex':'{$this->memberRow['sex']}',
	'zip':'{$this->memberRow['zip']}',
	'year':'{$birthday[0]}',
	'month':'{$birthday[1]}',
	'day':'{$birthday[2]}',
});
</script>